package com.tbs.parkingsaleapp.Http.Listenner;

import abstergo.tbs.betterasyc.AsycBase.IAsycBackgroundAction;
import abstergo.tbs.betterasyc.AsycBase.IAsycResultAction;
import com.alibaba.fastjson.JSON;
import com.tbs.parkingsaleapp.Http.HttpHelper;
import com.tbs.parkingsaleapp.Http.JsonData.Message;
import com.tbs.parkingsaleapp.SystemManager.NetWorkSetting;
import com.tbs.parkingsaleapp.UI.UserCenterPage.UserCenterFragment;

public class MessageHttper implements IAsycResultAction<Message[]>, IAsycBackgroundAction<String,Message[]> {

    UserCenterFragment fragment;
    public MessageHttper(UserCenterFragment fg)
    {
        fragment=fg;
    }

    @Override
    public Message[] BackGroundAction(String... params) throws Exception {
       String r= HttpHelper.Get(NetWorkSetting.GetMessagesUrl(params[0]));
        return JSON.parseObject(r,Message[].class);
    }

    @Override
    public void ResultFunction(Message[] result) {
        fragment.UpdateMessageList(result);
    }
}
